//
//  plannerTests.m
//  plannerTests
//
//  Created by 함동균 on 2014. 3. 11..
//  Copyright (c) 2014년 idea. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "CalendarMonth.h"
#import "CalendarMonth+Planner.h"

@interface plannerTests : XCTestCase
@property (nonatomic,retain) NSManagedObjectContext *moc;
@end

@implementation plannerTests

- (void)setUp
{
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
    NSManagedObjectModel *mom = [NSManagedObjectModel mergedModelFromBundles:nil];
    NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mom];
    [psc addPersistentStoreWithType:NSInMemoryStoreType
                    configuration:nil
                                URL:nil
                            options:nil
                              error:NULL];
    self.moc = [[NSManagedObjectContext alloc] init];
    self.moc.persistentStoreCoordinator = psc;
}

- (void)tearDown
{
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
    self.moc = nil;
}

- (void)testExample
{
    CalendarMonth *testCalendar = [CalendarMonth setYear:[NSNumber numberWithInt:2014]
                                                   month:[NSNumber numberWithInt:3]
                                  inManagedObjectContext:self.moc];
    
    if (testCalendar.days.count != 6 * 7)
        XCTFail(@"Days not created as expected");
}

@end
